package Logic;

import java.util.ArrayList;
import java.util.Collections;
import java.util.TreeMap;
import java.util.TreeSet;

public class PokerGame2 {
    static TreeMap<Integer,String> m=new TreeMap<>();
    static ArrayList<Integer> list=new ArrayList<>();
    static{
        String []sign={"♦","♣","♥","♠"};
        String []num={"3","4","5","6","7","8","9","10","J","Q","K","A","2"};
        int count=1;
        for (String n : num) {
            for (String s : sign) {
                m.put(count,s+n);
                list.add(count);
                count++;
            }
        }
        list.add(count);
        m.put(count,"小王");
        count++;

        list.add(count);
        m.put(count,"大王");


    }
    public PokerGame2(){
        //洗牌
        Collections.shuffle(list);

        //发牌
        TreeSet<Integer> lord=new TreeSet<>();

        TreeSet<Integer> player1=new TreeSet<>();
        TreeSet<Integer> player2=new TreeSet<>();
        TreeSet<Integer> player3=new TreeSet<>();

        int n=list.size();
        for (int i = 0; i < n; i++) {
            if(i>=n-3){
                lord.add(list.get(i));
            }else{
                if(i%3==0){
                    player1.add(list.get(i));
                }else if(i%3==1) {
                    player2.add(list.get(i));
                }else{
                    player3.add(list.get(i));
                }
            }
        }
        Look(lord,"底牌");
        Look(player1,"1");
        Look(player2,"2");
        Look(player3,"3");

    }

    public static void Look(TreeSet<Integer> list,String name){
        System.out.print(name+":");
        for (Integer i : list) {
            System.out.print(m.get(i)+" ");
        }
        System.out.println();
    }

}
